#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>

int main(int argc, char const *argv[])
{
	char* ptr;

	if (chdir("/tmp") < 0) {
		printf("chdir failed: %s\n", strerror(errno));
		return -1;
	}
	printf("chdir: %s\n", strerror(errno));
	
	ptr = (char*)malloc(128*sizeof(char));
	if (getcwd(ptr, 128) == NULL) {
		printf("getcwd failed: %s\n", strerror(errno));
		return -1;
	}
	printf("cwd = %s\n",ptr);
	return 0;
}